package com.example.demo.java8;

public class GoToStep {
	public static int calcStep(int n) {
		if(n == 1) {
			return 1;
		}else if(n==2) {
			return 2;
		}
		int[] count =new int[n+1];
		count[1] =1;
		count[2] =2;
		for (int i = 3; i < n+1; i++) {
			count[i] =count[i-1]+count[i-2];
		}
		return count[n];
	}
	
	
	public static void main(String[] args) {
		int n = 20;//总共还要上20层
		int allCount = calcStep(n);
		System.out.println("要上20层，总共有："+allCount);
	}
}